/*
********************************************************************************
* Copyright (C) 2021, xiang.D <dx_65535@163.com>.
* All right reserved.
*
* File Name   : main.cc
* Author      :
* Version     : V1.0
* Description :
* Journal     : 2021-01-08 init v1.0
* Brief       : Blog: https://blog.csdn.net/qq_38750572?spm=1001.2014.3001.5343
* Others      :
********************************************************************************
*/
#include <stdio.h>
#include "shop.h"

#define MAIN_LOGI(fmt, args...) printf("%d Main I: " fmt, __LINE__, ##args)
#define MAIN_LOGD(fmt, args...) printf("%d Main D: " fmt, __LINE__, ##args)
#define MAIN_LOGW(fmt, args...) printf("%d Main W: " fmt, __LINE__, ##args)
#define MAIN_LOGE(fmt, args...) printf("%d Main E: " fmt, __LINE__, ##args)
#define MAIN_LOG(fmt, args...)  printf(fmt, ##args)

int main(int argc, char *argv[])
{
    CShop theShop;
    float cost = 1000.0;

    // 普通用户
    MAIN_LOG("\n---------------------------------\n");
    MAIN_LOG(" All Cost      : %0.2f.   \n"
             " User Type     : %s.      \n"
             " Discount      : %0.2f.   \n"
             " Actual Payment: %0.2f.   \n",
             cost,
             theShop.GetUserDesc().c_str(),
             theShop.GetCurrentDiscountRate(),
             theShop.GetRealPrice(cost));


    // 切换白银会员
    MAIN_LOG("\n---------------------------------\n");
    theShop.SetConsumer(COSUMER_SILVER);
    MAIN_LOG(" All Cost      : %0.2f.   \n"
             " User Type     : %s.      \n"
             " Discount      : %0.2f.   \n"
             " Actual Payment: %0.2f.   \n",
             cost,
             theShop.GetUserDesc().c_str(),
             theShop.GetCurrentDiscountRate(),
             theShop.GetRealPrice(cost));

    // 切换黄金会员
    MAIN_LOG("\n---------------------------------\n");
    theShop.SetConsumer(COSUMER_GOLD);
    MAIN_LOG(" All Cost      : %0.2f.   \n"
             " User Type     : %s.      \n"
             " Discount      : %0.2f.   \n"
             " Actual Payment: %0.2f.   \n",
             cost,
             theShop.GetUserDesc().c_str(),
             theShop.GetCurrentDiscountRate(),
             theShop.GetRealPrice(cost));

    return 0;
}